fix(archiver): make addContractClass/Instance idempotent#23207
Draft
AztecBot wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Merge branch 'next' into merge-train/spartanCI (run 25747371483, log 1778600703708803) failed one2e_p2p/add_rollup.test.tswith aTimeout awaiting L1 to L2 message ... ready. The visible timeout was a symptom — throughout the run, validators on the new rollup repeatedly logged:…followed by
Checkpoint proposal validation failed: block_fetch_errorandBlock proposal validation failed: parent_block_not_found. With validators unable to attest, no checkpoint landed on L1, the L1→L2 inbox tree was never sealed for the next checkpoint, and the test eventually timed out.The throw was introduced by 1a9249a ("fix(archiver): throw on duplicate contract class or instance additions"), replacing the prior
setIfNotExists(silent-skip) behavior. The intent was to surface unexpected double-adds, but:(artifactHash, privateFunctionsRoot, publicBytecodeCommitment)— duplicate adds are guaranteed to carry identical data. Same for contract instances: the address is content-derived from instance fields.add_rollupon merge-train/spartan in fix(validator): include proposed checkpoint out-hashes when validating checkpoint proposals #23119), legitimate double-adds occur naturally — e.g. two transactions in the same block both publish the same class.deleteContractClass/deleteContractInstancewas already idempotent, skipping deletes when the existing entry's block is older than the rollback block. The throw on add was the only asymmetric failure point.Fix
Revert
addContractClassandaddContractInstanceto usesetIfNotExistssemantics — silently skip duplicates and keep the original entry'sl2BlockNumber/blockNumber. Preserving the original block number is important because the rollback path keys delete decisions onexisting.l2BlockNumber >= blockNumber: if block 5 first registers class X and block 6 re-emits the same event, on rollback of block 6 we want to leave class X intact (block 5 still references it).The two unit tests that asserted the old throw behavior are updated to assert the new no-op behavior, with the second test verifying that the original
l2BlockNumberis preserved across a duplicate add.Full analysis: https://gist.github.com/AztecBot/325efd9268bd6001350f22bcf2e2a601
Test plan
e2e_p2p/add_rollup.test.tspasses on merge-train/spartan CI.archiverunit tests pass (covering the new idempotent contract-class/instance store behavior).ClaudeBox log: https://claudebox.work/s/017d5e2dc6891bf4?run=1